home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / batch / tsbat36.zip / SCOPY.BAT < prev    next >
DOS Batch File  |  1991-08-18  |  2KB  |  70 lines

  1. echo off
  2. echo ┌──────────────────────────────────────────────────────────────────┐
  3. echo │   Same device COPY by Timo Salmi, ts@chyde.uwasa.fi, 18-Aug-91   │
  4. echo ├──────────────────────────────────────────────────────────────────┤
  5. echo │         NO paths NO device names allowed in file names           │
  6. echo └──────────────────────────────────────────────────────────────────┘
  7. echo.
  8. if "%1"=="" goto _err1
  9.  
  10. if not exist %1 goto _err2
  11. md r:\tmp$$$
  12. if not exist r:\tmp$$$\nul goto _err3
  13. if exist r:\tmp$$$\*.* goto _err4
  14. copy/v %1 r:\tmp$$$\%1
  15. echo %1 copied to r:\tmp$$$\%1
  16. echo Change the target disk to the drive
  17. pause
  18. if exist %1 goto old
  19. copy/v r:\tmp$$$\%1 %1
  20. echo r:\tmp$$$\%1 copied to %1
  21. goto _dele
  22.  
  23. :old
  24. echo %1 already exists!
  25. echo Apply break to exit without copying
  26. echo (If you break, you must then manually remove the TMP$$$ directory and its files)
  27. echo Strike a key when ready to copy . . .
  28. pause > nul
  29. copy/v r:\tmp$$$\%1 %1
  30. echo r:\tmp$$$\%1 copied to %1
  31. goto _dele
  32.  
  33. :_err1
  34. echo Usage SCOPY FileNameWithoutPath
  35. echo.
  36. echo This batch is intended for copying one file at a time when only a single
  37. echo device, and a ramdisk D: are available. Wildcards are allowed, but not
  38. echo recommended. You must NOT use paths in file names! Be careful if you copy
  39. echo a file located in a subdirectory. The destination directory depends on the
  40. echo directory tree (if any) of the destination disk. (It will be the root or
  41. echo a directory with an equivalent name.)
  42. goto _out
  43.  
  44. :_err2
  45. echo File %1 not found
  46. goto _out
  47.  
  48. :_err3
  49. echo Directory r:\tmp$$$ could not be created
  50. goto _out
  51.  
  52. :_err4
  53. echo Directory r:\tmp$$$ is not empty
  54. goto _out
  55.  
  56. :_dele
  57. if not "%1" == "*.*" goto _dele2
  58. if not exist r:\tmp$$$\%1 goto _rmdir
  59. echo y|del r:\tmp$$$\%1 > nul
  60. goto _rmdir
  61.  
  62. :_dele2
  63. if exist r:\tmp$$$\%1 del r:\tmp$$$\%1
  64.  
  65. :_rmdir
  66. rd r:\tmp$$$
  67.  
  68. :_out
  69. echo on
  70.